<html>
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover">
    <meta charset='utf-8'>
<h1>存储检测</h1>
<input type="text" placeholder="键" id="key">
<input type="text" placeholder="值" id="value">
<button id="yes" class="reg">确定</button><br>
<button id="check" class="reg">按键查询</button>
<br>
<button onclick="document.location='index.html'"  class="reg">返回</button>

</html>
<script>
    document.getElementById("yes").addEventListener("click", function () {
        if(document.getElementById("key").value){
            localStorage.setItem(document.getElementById("key").value, document.getElementById("value").value);
        }else{
            localStorage.removeItem(document.getElementById("key").value);
        }
        alert("OK")
    });
    document.getElementById("check").addEventListener("click", function () {
        alert(localStorage.getItem(document.getElementById("key").value));
    });
</script>

<style>
    	.reg{   
        width: 300px;   
        min-height: 20px;   
        display: block;   
        color: #000;   
        padding: 9px 14px;   
        font-size: 15px;   
        line-height: normal;   
        border-radius: 5px;   
        margin: 0;   
	text-decoration:none
    }  

</style>